#ifndef XITEM_H
#define XITEM_H
#include <string>
#include <list>
#include <vector>
#include <boost/noncopyable.hpp>
#include <xscript/xdefs.h>
#include <xscript/xitemtype.h>
#include <xscript/xitemconvertor.h>

class XItem : public XItemConvertor, public XItemType, public std::enable_shared_from_this<XItem>, public boost::noncopyable {
  public:
    XItem();
    XItem(const std::wstring& name);
    virtual ~XItem() = default;
  public:
    static std::shared_ptr<XItem> createFromToken(std::shared_ptr<XToken> token);

    virtual std::shared_ptr<XItem> asItem()override {
        return shared_from_this();
    }

    void setName(const std::wstring& name);

    std::wstring getName()const {
        return itemName;
    }

    void setLineNumber(uint32_t line) {lineNumber = line;}
    uint32_t getLineNumber()const {return lineNumber;}

    virtual void accept(std::shared_ptr<XItemVisitor> visitor);
  public:
    std::wstring getItemTypeInfo();
    virtual std::wstring getAddress();
    virtual std::wstring getItemInfo();
  protected:
    std::wstring itemName;
    uint32_t lineNumber = ~0;
};

using XItemVectorType = std::vector<std::shared_ptr<XItem>>;

#endif // XITEM_H
